﻿using System;

namespace learn_csharp
{
    class Program
    {
        static void Main(string[] args)
        {
            PrintDataType();
            DefineVar();
        }

        private static void DefineVar()
        {
            // 整形的
            sbyte _aSbyte = -0x80;
            short _aShort = -0x8000;
            int _aInt = -0x80000000;
            long _aLong = -0x8000000000000000;
            Console.WriteLine("有符号整型");
            Console.WriteLine("SByte: " + _aSbyte);
            Console.WriteLine("Short: " + _aShort);
            Console.WriteLine("Int: " + _aInt);
            Console.WriteLine("Long: " +_aLong);

            byte _aByte = 0xff;
            ushort _auShort = 0xffff;
            uint _auInt = 0xffffffff;
            ulong _auLong = 0xffffffffffffffff;
            Console.WriteLine("无符号整型");
            Console.WriteLine("Byte: " + _aByte);
            Console.WriteLine("UShort: " + _auShort);
            Console.WriteLine("UInt: " + _auInt);
            Console.WriteLine("ULong: " + _auLong);


            // 浮点型
            float _aFloat = 0.00000005F;
            double _aDouble = 0.000000000000000005;
            Console.WriteLine("浮点型");
            Console.WriteLine("Float: " + _aFloat);
            Console.WriteLine("Double: " + _aDouble);

            // 布尔
            bool _aBool = true;
            Console.WriteLine("布尔类型");
            Console.WriteLine("Bool: " + _aBool);

            string _aString = '1'.ToString();
            char _aChar = '2';
            Console.WriteLine("字符类型");
            Console.WriteLine("String: " + _aString);
            Console.WriteLine("Char: " + _aChar);
        }

        private static void PrintDataType()
        {
            // 整形的
            Console.WriteLine("有符号整型");
            Console.WriteLine("SByte: " + sbyte.MinValue + "~" + sbyte.MaxValue);
            Console.WriteLine("Short: " + short.MinValue + "~" + short.MaxValue);
            Console.WriteLine("Int: " + int.MinValue + "~" + int.MaxValue);
            Console.WriteLine("Long: " + long.MinValue + "~" + long.MaxValue);

            Console.WriteLine("无符号整型");
            Console.WriteLine("UShort: " + ushort.MinValue + "~" + ushort.MaxValue);
            Console.WriteLine("UInt: " + uint.MinValue + "~" + uint.MaxValue);
            Console.WriteLine("ULong: " + ulong.MinValue + "~" + ulong.MaxValue);
            Console.WriteLine("Byte: " + byte.MinValue + "~" + byte.MaxValue);

            // 浮点型
            Console.WriteLine("浮点型");
            Console.WriteLine("Float: " + float.MinValue + "~" + float.MaxValue);
            Console.WriteLine("Double: " + double.MinValue + "~" + double.MaxValue);

            // 布尔
            Console.WriteLine("布尔类型");
            Console.WriteLine("Bool: " + bool.TrueString + "~" + bool.FalseString);


            // 字符型
            Console.WriteLine("字符型");
            Console.WriteLine("String: " + string.Empty);
            Console.WriteLine("Char: " + char.MinValue + "~" + char.MaxValue);
        }
    }
}
